**********************************
* WD 1770 Floppy Disk Controller *
**********************************
 
* automatic track seek with verify
* soft-sector format compatibility
* read or write with:
                     single or multiple records
                     automatic sector search
                     entire track read or write
* programmable:
                track to track stepping time
                head settling time
                head engage time
                three-phase or step-plus-direction motor control
                dma or program transfers
 
 
Communicating with the 1770 is accomplished by accessing six registers.
 
Address bits          MODE
   A1    A0    READ           WRITE
------------------------------------------
   0     0     Status reg.    Command reg.
   0     1     Track reg.     Track reg.
   1     0     Sector reg.    Sector reg.
   1     1     Data reg.      Data reg.
 
Where A0 and A1 are pins three and four, respectively.
In the Commodore 1571 the WD1770 is located at addresses $2000 to $2003.
 
The command register recognizes eleven commands:
 
   Command   command word bits  7 6 5 4 3 2 1 0
   -------                      ---------------
1.  Restore                     0 0 0 0 h v x y
2.  Seek                        0 0 0 1 h v x y
3.  Step                        0 0 1 u h v x y
4.  Step in                     0 1 0 u h v x y
5.  Step out                    0 1 1 u h v x y
6.  Read sector                 1 0 0 m h e 0 0
7.  Write sector                1 0 1 m h e p a
8.  Read address                1 1 0 0 h e 0 0
9.  Read track                  1 1 1 0 h e 0 0
10. Write track                 1 1 1 1 h e p 0
11. Force interrupt             1 1 0 1 i j k 1
 
with the special bits defined as follows:
 
h   -   0= motor on / 1= motor off
v   -   0= verify track / 1= don't verify
x/y -   Step rate
                    1770                1771        1772
            0 0      6ms (166steps/sec)  6ms        ?
            0 1     12ms (88)            6ms        ?
            1 0     20ms (50)            8ms        ?
            1 1     30ms (33)           10ms        ?
 
u   -   0= don't / 1= do    set track reg to track in sector header
m   -   0= read one sector / 1= read several
a   -   0= set data mark for 'sector valid'
        1= set data mark for 'sector erased'
e   -   0= no head settling time
        1= 30ms head settling time
p   -   0= precompensation on / 1= precompensation off
i   -
j   -
k   -   index hole interrupt enable
l   -   immediate unconditional interrupt
        command ends without interrupt if i-j = 0
 
STATUS REGISTER
 
Bit
0.  Busy flag            -   a command is being executed
1.  Data request/index   -   signals that data can read/write from DATA reg
2.  Lost data/track 00   -   for commands 1 - 5 indicates head on track one
                             for others, indicates that data reg was lost
3.  CRC error            -   header or data block checksum incorrect
4.  Record not found     -   Specified track or sector was not found
5.  Spinup/record type   -   for commands 1 - 5 indicates six rotations
                             for cmds 6 - 11   bit holds 'data mark'
6.  Write protect        -   When writing indicates that wrt prot is on
7.  Motor on             -   motor staus 0= off / 1= on
 
 
WD1770 Pin Layout *
 
Pin  Name   Function
---  ----   --------
1    CS     Chip select (low)
2    R/W    0= write / 1= read    registers
3/4  A0/1   Register address lines   when cs=0
5-12 D0-7   Data bus
13   MR     Master reset low
14   GND    ground connection
15   Vcc    +5 Volts
16   STEP   Output for step pulses to the head motor
17   DIRC   Step direction
18   CLK    Input for 8Mhz clock
19   RD     Read data from disk (also contains clock)
20   MO     Motor on switch
21   WG     Write gate  =1 if disk is being written to
22   WD     Write data pulses (along with clock) to disk
23   TR00   Track 0 input 0= head on track 0 / 1= not on 0
24   IP     Index pulse
25   WPRT   Write protect  0= write prtoect / 1= not protect
26   DDEN   Double density  if =0 / 1= single density *
27   DRQ    Data request   1= data register is ready
28   INTRQ  Interrupt request    1= end command
 
* Note that in the Commodore 1571, pins 16,17,20,23,27, and 28 are unconnected
* pin 26 is held low (double density)
 
* If you own a Commodore 1581 and find that it contains a WD1770 you should
* see you Commodore authorized service center about replacing it with
* a WD1772 - as far as I know, Commodore is still replacing them even out
* of warranty as of April 1988
 
 
*****************************************************************
This information is the compilation of several sources, including
direct experimentation, and is provided without any guarantees of
accuracy or any assumption of liability on my part.         GTK
*****************************************************************
 
 
Commodore 1571 and 1581 are trademarks or registered trademarks of
Commodore International Ltd.
 
WD1770, 1771, and 1772 are trademarks of Western Digital Corp.
                                         3218 Redhill Avenue
                                         Newport Beach, CA 92663
                                         (714) 557-3550
                                         TWX: (910) 595-1139
